<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('courses', function (Blueprint $table) {
            $table->id();
            $table->string('title');
            $table->string('cover')->nullable()->default('');
            $table->tinyInteger('type_id')->default(0);
            $table->string('brief')->nullable()->default('');
            $table->decimal('price')->default(0);
            $table->decimal('original_price')->default(0);
            $table->integer('sort')->default(0);
            $table->integer('clicks')->default(0);
            $table->tinyInteger('level')->default(0)->comment('层级 1大专栏 2 专栏');
            $table->string('tag')->nullable()->comment('标签');
            $table->tinyInteger('status')->default(0)->comment('状态 0未上架 1 已上架');
            $table->tinyInteger('shop_type')->default(1)->comment('售卖方式 0免费 1 付费 2加密 3指定学员');
            $table->string('password')->nullable()->default('');
            $table->longText('content')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('courses');
    }
};
